package com.zcf.controller;


import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.zcf.common.json.Body;
import com.zcf.pojo.Consoleuser;
import com.zcf.service.ConsoleuserServiceImpl;
import com.zcf.vo.out.LayuiJson;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ZhaoQi
 * @since 2019-03-18
 */
@CrossOrigin
@Controller
@RequestMapping("/consoleuser/")
public class ConsoleuserController {
	@Autowired
	ConsoleuserServiceImpl csi;
	/**
	 * 后台登录 
	 * @param cl
	 * @return
	 */
	@PostMapping("login")
	@ResponseBody
	public Body login(Consoleuser cl, HttpServletRequest request){
		return csi.login(cl,request);
	}

	/**
	 * 管理员修改账号或密码
	 * @param cl
	 * @return
	 */
	@PostMapping("update")
	@ResponseBody
	public Body update(Consoleuser cl){
		return csi.update(cl);
	}
	/**
	 * 获取登录日志
	 * @return
	 */
	@PostMapping("getlogin")
	@ResponseBody
	public LayuiJson getlogin(@RequestParam(value = "pageNum") int pageNum,
            @RequestParam(value = "pageSize") int pageSize){
		return csi.getlogin(pageNum,pageSize);
	}


}

